/// ---------------------------------------------
/// 用于通用上传
/// 江懷玉
///
/// ---------------------------------------------
$(document).ready(function(){
$("body").append("<div id='upload_div' style='position:absolute; z-index:10001;bgcolor:#eee;width:300px;height:100px;border:solid 3px #ddd;display:none'></div>");
	$(document).click(function(event){
		//alert($(event.target).attr("class"));
		var element=event.target;
		var emeCls=$(element).attr("bj");
//		if(emeCls!="cBj"){
//		    $("#upload_div").css("display", "none");
//		}
 	 });
});
$.fn.upload = function(options) {
    var defaults = {
        ipt: this,
        evt: "click"
    };
    if (options) {
        $.extend(defaults, options);
    }
    var e = defaults.evt;
    var obj = defaults.ipt;
    if (e == "click") $(this).click(showCar);
    if (e == "mouseover") $(this).mouseover(showCar);
    //在页面上显示日期选择界面
    function showCar() {
        var iptId = $(obj).attr("id").replace('btn', '');
        carHtml(iptId);
        var tLeft = $(obj).offset().left;
        var tTop = $(obj).offset().top + 20;
        $("#upload_div").css({ display: "block", left: tLeft, top: tTop });
        //alert("");
        //window.setTimeout("", 100);
    }
    //生成日历html代码
    function carHtml(vipt) {
        var carArr = new Array();
        carArr.push('<iframe scrolling="no" frameborder="0"  src="../Extend/AjaxData/UploadFile.aspx?c=' + vipt + '" style="width:100%;height:100%;"></iframe><a style="float:right" href="javascript:closeUpload_div();">关闭</a>');
        var htmlStr = carArr.join("");
        $("#upload_div").html(htmlStr);
    }
}

function onUpload(id,value) {
    $("#" + id).val(value);
}
function onUploadHide(id, value) {
    $("#" + id).val(value);
}
function closeUpload_div() {
    $("#upload_div").css("display", "none");
}